#include "xtransition_game_info.h"
#include <xgame_data.h>
#include <xcocos_utils.h>
#include "xconstant.h"
#include "xgame_data.h"
#include <xstring.h>
#include "SimpleAudioEngine.h"
#include "xui.h"
#include "xpicture_number.h"
namespace zdh
{
	//--------------------------------------------------------------------------------------
	XTransitionGameInfo::XTransitionGameInfo()
	{

	}
	//--------------------------------------------------------------------------------------
	XTransitionGameInfo::~XTransitionGameInfo()
	{

	}
	//--------------------------------------------------------------------------------------
	void XTransitionGameInfo::onEnter()
	{
		CCTransitionScene::onEnter();
		CCSprite * pBG = utils::createSprite("background_layer0.png");
		utils::ToFullScreen(pBG);
		this->addChild(pBG, 0);

		CreateByXUI(this, "game_info.ini");

		CCPictureNumber * pGK = dynamic_cast<CCPictureNumber *>(this->getChildByTag(12));
		CCPictureNumber * pMB = dynamic_cast<CCPictureNumber *>(this->getChildByTag(13));
		pGK->BuildNumber(GAME_DATA->PassGate);
		pMB->BuildNumber(GAME_DATA->PassScore(GAME_DATA->PassGate));

		pBG->runAction(CCSequence::create(CCDelayTime::create(1.5f), CCCallFunc::create(this, callfunc_selector(XTransitionGameInfo::OnActionFinish)), NULL));
		CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("sounds/logo.wav");

	}
	//--------------------------------------------------------------------------------------
	XTransitionGameInfo * XTransitionGameInfo::create(float t, CCScene *scene)
	{
		XTransitionGameInfo * pScene = new XTransitionGameInfo();
		if (pScene && pScene->initWithDuration(t, scene))
		{
			pScene->autorelease();
			return pScene;
		}
		CC_SAFE_DELETE(pScene);
		return NULL;
	}
	//--------------------------------------------------------------------------------------
	void XTransitionGameInfo::OnActionFinish(void)
	{
		CCTransitionScene::finish();
	}

}
